﻿namespace ScrumLite.WebUx.Tests
{
    using System;
    using System.Collections.Generic;
    using System.Collections.ObjectModel;
    using System.Linq;
    using ScrumLite.Services;
    using ScrumLite.Services.Contracts;

    public class MockPeopleService : IPeopleService
    {
        public bool GetPersonEducationCalled { get; set; }
        public bool GetPersonAbilitiesCalled { get; set; }

        private static List<Education> education;
        private static List<Ability> abilities;

        public MockPeopleService()
        {
            education = new List<Education>();
            education.Add(new Education { Id = Guid.NewGuid(), PersonId = "southy", Title = "Bachellor", Certifier = "St. Victoria", Completed = true });
            education.Add(new Education { Id = Guid.NewGuid(), PersonId = "southy", Title = "Engineer", Certifier = "UBA", Completed = false });
            education.Add(new Education { Id = Guid.NewGuid(), PersonId = "southy", Title = "MCA", Certifier = "Microsoft", Completed = true });
            education.Add(new Education { Id = Guid.NewGuid(), PersonId = "southy", Title = "Five Stars", Certifier = "Microsoft", Completed = true });

            abilities = new List<Ability>();
            abilities.Add(new Ability { Id = Guid.NewGuid(), Name = "C#" });
            abilities.Add(new Ability { Id = Guid.NewGuid(), Name = "ASP.NET" });
            abilities.Add(new Ability { Id = Guid.NewGuid(), Name = "Windows Communication Foundation (WCF)" } );
            abilities.Add(new Ability { Id = Guid.NewGuid(), Name = "Security Token Service (STS)" } );
            abilities.Add(new Ability { Id = Guid.NewGuid(), Name = "Cardspace" });
        }

        public Education[] GetPersonEducation(string personId)
        {
            this.GetPersonEducationCalled = true;

            var personEducation = (from e in education
                                   select e).ToArray();

            return personEducation;
        }

        public Ability[] GetPersonAbilities(string personId)
        {
            this.GetPersonAbilitiesCalled = true;

            var personAbilities = (from a in abilities
                                   select a).ToArray();

            return personAbilities;
        }
    }
}
